// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICachingService.cs" company="Scrum for Team System">
//   None
// </copyright>
// <summary>
//   Defines the ICachingService type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ScrumForTeamSystem.EventService.Infrastructure.Interfaces
{
    using System;

    /// <summary>
    /// Defines the caching service interface
    /// </summary>
    public interface ICachingService : IMessageProducer
    {
        /// <summary>
        /// Caches the object.
        /// </summary>
        /// <typeparam name="T">The type of the item to cahce</typeparam>
        /// <param name="cacheId">The cache id.</param>
        /// <param name="item">The item to cache.</param>
        void CacheObject<T>(string cacheId, T item);

        /// <summary>
        /// Gets the cached item.
        /// </summary>
        /// <typeparam name="T">The type of the item to cahce</typeparam>
        /// <param name="cacheId">The cache id.</param>
        /// <returns>The cached item</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification = "Pattern requires generic type parameter")]
        T GetCachedItem<T>(string cacheId);

        /// <summary>
        /// Determines whether the specified cache id contains key.
        /// </summary>
        /// <param name="cacheId">The cache id.</param>
        /// <returns>
        /// <c>true</c> if the cache contains the specified key; otherwise, <c>false</c>.
        /// </returns>
        bool ContainsKey(string cacheId);

        /// <summary>
        /// Determines whether [the specified cache id] [is type of].
        /// </summary>
        /// <param name="cacheId">The cache id.</param>
        /// <param name="type">The comparisson type.</param>
        /// <returns>
        /// <c>true</c> if [the specified cache id] [is type of]; otherwise, <c>false</c>.
        /// </returns>
        bool IsTypeOf(string cacheId, Type type);
    }
}